1 Introduction

1.1 Documenting community changes

  • Many papers report local species richness and temporal trends
    • Abundance (Klink et al. 2020)
    • Species richness: (Vellend et al. 2013; Dornelas et al. 2014)
  • Other aspects of community structure vary through time:
    • Composition: (Dornelas et al. 2014; Hillebrand et al. 2018)
    • Functional diversity (Barnagaud et al. 2017)
    • Evenness (ref)

1.2 Why do we want to assess community changes ?

  • Global changes have affect a tremendous effect communities
  • Understanding assembly and disassembly rules
  • Give a more complex and complete picture of what is going on ?

1.4 Research questions

  • What are the drivers of community changes ?
    • Climate change: more appearance and disappearance in the upper basin
    • More species turnover far from the source because of dispersal ability
  • Temporal homogeneization at the basin scale?
    • Similary in accordance to distance through distance?
  • Product:
    • Map of temperature and distance to effect on turnover by basin ?

2 Methods

2.1 Data selection

  • Unique protocol and unique unit of abundance by site
  • One sampling by year and site
  • In each site, samplings should be in the median (more or less one month and half, i.e. 1.5 month)
  • 5 samplings by site, span 10 years
loc <- filtered_dataset$location %>%
  left_join(filtered_dataset$site_quali, by = "siteid") %>%
  st_as_sf(coords = c("longitude", "latitude"),
  crs = 4326)
fig_sites <- paste0(
  "Australia absence because span is superior to 10 years of 100s of sites but number of samplings < 10.")
world <- ne_countries(scale = "medium", returnclass = "sf")
bb <- st_bbox(loc)
ggplot(data = world) +
    geom_sf() +
    geom_sf(data = loc, aes(color = protocol), shape = 1) +
    theme(legend.position = "bottom") +
    labs(title = paste0("Number of sites: ", nrow(loc)))
Australia absence because span is superior to 10 years of 100s of sites but number of samplings < 10.

Figure 2.1: Australia absence because span is superior to 10 years of 100s of sites but number of samplings < 10.

2.2 Biodiversity

2.2.1 Quantity

  • Hill numbers
    • \(H^0\): Species richness
    • \(H^1\): Shannon
    • \(H^2\): Simpson

We used also hill numbers with coverage-based correction proposed by (???)

  • Evenness:
    • Pielou: \(J = H^1 / log(S)\)

2.2.2 Betadiversity

Betadiversity metrics compares the composition of two communities. In our case, we compare the composition of each time step relatively to the baseline, i.e. the first year of sampling.

  • Species exchange index: (Hillebrand et al. 2018)
    • Presence-absence: \(J = SER_r = \dfrac{S_{imm} + S_{lost}}{S_{tot}}\)
    • Relative abundance: \(SER_a = \dfrac{\sum_i (p_i - p^{\prime}_i)^2}{\sum_i p_i^2 + \sum_i p^{\prime2}_i - \sum_i p_i p^{\prime}_i}\)

    • \(S_{imm}\), \(S_{lost}\), \(S_{tot}\): number of immigrant, lost and total species respectively
    • \(i\): species \(i\), \(p\): relative abundance, \(\prime\): second community
    • \(J\): Jaccard index

Turnover metrics based on presence/absence can be decomposed in appearance/disappearance and nestedness / turnover.

  • appearance: \(\dfrac{S_{imm}}{S_{tot}}\), disappearance: \(\dfrac{S_{lost}}{S_{tot}}\)

  • Turnover: \(J_t = \dfrac{2 * min(S_{lost}, S_{imm})}{S_{common} + (2 * min(S_{lost}, S_{imm})}\)
  • Nestedness: \(SER_r - J_t\)

3 Environment (Coming soon)

4 Statistical analysis

  • Simple lm by site

5 Results

5.2 Average

slope <- map_dfr(rigal_trends,
  ~.x %>%
  select(siteid, linear_slope),
.id = "response"
)
rigal_trends_df <-  map2_dfr(
  rigal_trends, names(rigal_trends),
  ~.x %>% mutate(variable = .y)
  ) %>%
select(variable, siteid, linear_slope) %>%
pivot_wider(names_from = "variable", values_from = "linear_slope")
summary_slope <- slope %>%
  group_by(response) %>%
  summarise(summ = list(enframe(summary_distribution(linear_slope, na.rm = TRUE)))) %>%
  unnest(cols = summ) %>%
  pivot_wider(names_from = "name", values_from = "value") %>%
  select(response, mean, median, sd)
summary_slope %>%
  mutate(response = get_var_replacement()[response]) %>%
  kable() %>%
  kable_styling(bootstrap_options = c("striped", "bordered", "hover")) %>%
  scroll_box(width = "100%", height = "1000px")
response mean median sd
Appearance 0.0043083 0.0013017 0.0160590
Chao (binary, similarity) -0.0039328 0.0000000 0.0218819
Chao evenness 0.0021943 0.0000000 0.0869975
Chao species richness 0.0160926 0.0027879 0.1864729
Chao shannon 0.0109086 0.0033085 0.1104958
Chao simpson 0.0077291 0.0026013 0.0994345
Disappearance 0.0019926 0.0000000 0.0127173
Evenness 0.0010409 0.0000280 0.0185918
SER_a (rel abundance) -0.0082370 -0.0035286 0.0273119
Horn (binary, similarity) -0.0052693 -0.0032226 0.0184560
Jaccard (binary, similarity) -0.0066054 -0.0041915 0.0211723
Jaccard (binary, dissimilarity) 0.0066054 0.0041915 0.0211723
Log species richness 0.5690175 0.1305570 3.5608475
Log total abundance 1.2164360 0.5582744 8.8216646
Nestedness (jaccard) 0.0029121 0.0001510 0.0211512
Shannon 0.0031355 0.0008848 0.0287062
Simpson 0.0013521 0.0002939 0.0142783
Species richness 0.0233072 0.0038939 0.1763604
Total turnover (codyn) 0.0063009 0.0038111 0.0197541
Total abundance 2.2395645 0.0955316 42.9647716
Turnover (jaccard) 0.0036933 0.0000000 0.0230755
p_jt_sup_ne <- sum(abs(rigal_trends_df$turnover) > abs(rigal_trends_df$nestedness)) /
  nrow(rigal_trends_df)
  • To compare with Dornelas et al. (2014):
    • Species richness:
      • Dornelas et al. (2014): 1557 measurements of species richness in two consecutive times, 629 (40%) increase, 624 (40%) decrease, and 304 (20%) do not change.
      • Our study: 13% increase, 7% decrease, 78% do not change, median: + 131% species by decade (i.e from 2 to 3 species, 10 to 15 species in 10 years)
    • Jaccard:
      • 10% species replaced per decade (Dornelas et al. 2014)
      • 28% of species replaced per decade (Blowes et al. 2019)
      • our study: 4% of species per decade
    • Turnover / nestedness:
      • Blowes et al. (2019): 97% of study shows turnover exceeding nestedness
      • our study: 44%
    • Jaccard vs dominance-based SER:
      • low correlation: \(0.34\)
rigal_trends_df %>%
  ggplot(aes(x = jaccard , y = hillebrand)) +
  geom_point() +
#  geom_smooth(method = "gam") +
  labs(x = "Jaccard trends (similarity, binary)", y = "Hillebrand trends
    (similarity, relative abundance)")

rigal_trends_df_loc <- filtered_dataset$location %>%
  left_join(rigal_trends_df, by = "siteid") %>%
  st_as_sf(coords = c("longitude", "latitude"),
  crs = 4326)

5.5 Rarity

Cf other document

5.6 Spatial scale

  • Selection on basin data

5.7 Environment

5.7.1 PCA

library(ade4)
library(factoextra)
#> Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
tar_load(rigal_slp_df)
slope_df <- rigal_slp_df
res.pca <- dudi.pca(select(slope_df, -siteid),
  scannf = FALSE,   # Hide scree plot
  nf = 5            # Number of components kept in the results
)
fviz_eig(res.pca)

p_pca <- map(list(c(1,2), c(2, 3), c(1, 3)),
  ~fviz_pca_var(res.pca,
    axes = .x,
    col.var = "contrib", # Color by contributions to the PC
    gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
    repel = TRUE     # Avoid text overlapping
    ) +
  theme(legend.position = "none") + labs(title = "")
)

plot_grid(plotlist = p_pca, ncol = 1)
#> Warning: ggrepel: 8 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps

5.7.1.1 Environment

tar_load(riveratlas_site)
riveratlas_site <- riveratlas_site %>%
  mutate(across(starts_with("tmp_"), ~.x / 10))
riv <- riveratlas_site %>%
  select(all_of(get_river_atlas_significant_var())) %>%
  st_drop_geometry()
riv %>%
  pivot_longer(cols = everything(), names_to = "variable", values_to = "values") %>%
  ggplot(aes(x = values)) +
  geom_histogram() +
  facet_wrap(~variable, scales = "free_x")
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

pca_riv <- dudi.pca(df = scale(riv), scannf = FALSE, nf = 3)
  • We see two main axis (as I found in France):
    • First axis related to stream size (distance from source, River area)
    • Second axis related to Temperature
fviz_eig(pca_riv)


p_pca <- map(list(c(1,2), c(2, 3), c(1, 3)),
  ~fviz_pca_var(pca_riv,
    axes = .x,
    col.var = "contrib", # Color by contributions to the PC
    gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
    repel = TRUE     # Avoid text overlapping
    ) +
  theme(legend.position = "none") + labs(title = "")
)

p_pca[[1]]
#> Warning: ggrepel: 5 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps

p_pca[[2]]
#> Warning: ggrepel: 6 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps

p_pca[[3]]
#> Warning: ggrepel: 4 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps

#### Environment - Trends

tar_load(slp_env)
slp_env_for_pca <- slp_env %>%
  select(-all_of(c("siteid", "main_bas", "ecoregion", "geometry"))) %>%
  rename(get_river_atlas_significant_var())
slp_env_for_pca$geometry <- NULL
  
pca_slp_env <- dudi.pca(
  df = scale(na.omit(slp_env_for_pca)),
  scannf = FALSE, nf = 3)
p_slp_env_pca <- map(list(c(1,2), c(2, 3), c(1, 3)),

  ~fviz_pca_var(pca_slp_env,
    axes = .x,
    col.var = "contrib", # Color by contributions to the PC
    gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
    repel = TRUE     # Avoid text overlapping
    ) +
  theme(legend.position = "none") + labs(title = "")
)

p_slp_env_pca[[1]]
#> Warning: ggrepel: 23 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps

p_slp_env_pca[[2]]
#> Warning: ggrepel: 19 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps

p_slp_env_pca[[3]]
#> Warning: ggrepel: 22 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps

5.7.2 Model

paste0(var_temporal_trends,
  " ~ ",
  "dist_up_km + tmp_dc_cyr +
  (1 + dist_up_km + tmp_dc_cyr | main_bas)"
) %>%
as.formula
library(spaMM)
#> Registered S3 methods overwritten by 'registry':
#>   method               from 
#>   print.registry_field proxy
#>   print.registry_entry proxy
#> spaMM (Rousset & Ferdy, 2014, version 3.9.25) is loaded.
#> Type 'help(spaMM)' for a short introduction,
#> 'news(package='spaMM')' for news,
#> and 'citation('spaMM')' for proper citation.
tar_load(c(trend_env))
names(trend_env) <- var_temporal_trends
ti_trends <- map(var_temporal_trends,
  ~fitme(
  as.formula(paste0("scale(", .x, ") ~ dist_up_km + tmp_c_cyr + (1 | main_bas)")),
  data = slp_env[,
    colnames(slp_env) %in%
    c(.x, "siteid", "dist_up_km", "tmp_c_cyr", "main_bas", "ecoregion")
  ]
  )
)
names(ti_trends) <- var_temporal_trends
ci <- map_dfr(ti_trends[names(ti_trends) %in% c("log_total_abundance", "log_species_nb", "jaccard",
      "appearance", "disappearance", "turnover",
      "nestedness", "hillebrand")], function(v) {
  x <- confint(v, c("dist_up_km", "tmp_c_cyr"), verbose = FALSE)
  tmp <- map_dfr(x, function(x) {
    tm <- x$interval
    names(tm) <- c("lower", "upper")
    return(tm)
  }, .id = "parm"
  )
  return(tmp)
}, .id = "response")
#> Iterative algorithm converges slowly.
#> Iterative algorithm converges slowly.
ci %>%
  kable(.,
    caption = "Confidence interval (bootstrap)")
Table 5.1: Confidence interval (bootstrap)
response parm lower upper
log_total_abundance dist_up_km 0.0001544 0.0004751
log_total_abundance tmp_c_cyr -0.0124125 0.0108759
log_species_nb dist_up_km 0.0000083 0.0003255
log_species_nb tmp_c_cyr 0.0044921 0.0297051
jaccard dist_up_km 0.0001336 0.0004517
jaccard tmp_c_cyr -0.0262087 -0.0012096
hillebrand dist_up_km 0.0000493 0.0003720
hillebrand tmp_c_cyr -0.0283098 -0.0062380
appearance dist_up_km -0.0002093 0.0000992
appearance tmp_c_cyr -0.0035101 0.0237618
disappearance dist_up_km -0.0004606 -0.0001410
disappearance tmp_c_cyr -0.0086671 0.0101726
nestedness dist_up_km -0.0002258 0.0000962
nestedness tmp_c_cyr -0.0090806 0.0150305
turnover dist_up_km -0.0003523 -0.0000345
turnover tmp_c_cyr -0.0015705 0.0162845
from_data_to_predict <- function(
  model_list = NULL,
  dataset = NULL,
  re = NULL
) {

  pred <- na.omit(dataset)
  for (i in seq_along(names(model_list))) {
    tmp <- predict(model_list[[i]],
      re.form = as.formula(re),
      intervals = "predVar"
      )[,1]
    names(tmp) <- NULL
    pred[[names(model_list)[i]]] <- tmp
  }
  return(pred)
}
xx <- list(
    tmp_c_cyr = seq(min(na.omit(slp_env$tmp_c_cyr)), max(na.omit(slp_env$tmp_c_cyr)), length.out = 10),
    dist_up_km = seq(min(na.omit(slp_env$dist_up_km)), max(na.omit(slp_env$dist_up_km)), length.out = 10),
    main_bas = unique(na.omit(slp_env$main_bas))
)
new_data <- expand.grid(xx) %>%
    as_tibble()
pred <- predict(ti_trends[[1]], newdata = new_data, re.form = re, intervals="predVar")
int <- cbind(pred[,1], attr(pred, "intervals")) %>%
    as_tibble() %>%
    rename(y = V1)
xxx <- cbind(int, new_data) %>%
    as_tibble
xxx %>%
    ggplot(aes(y = y, x = dist_up_km, color = main_bas)) +
    geom_point() +
    theme(legend.position = "none")
re <- paste0("~ tmp_c_cyr + (1 | main_bas)")
pred_tmp <- from_data_to_predict(
  model_list = ti_trends,
  dataset = slp_env,
  re = re
)
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
#> 
  |                                                                      
  |                                                                |   0%
  |                                                                      
  |ssssssssssssssssssssssssss                                      |  41%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssss            |  81%
  |                                                                      
  |ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss| 100%
p_tmp <- map(
  c(
      "log_total_abundance", "log_species_nb", "jaccard",
      "appearance", "disappearance", "turnover",
      "nestedness", "hillebrand"),
  function(x) {
    pred_tmp %>%
      ggplot(aes(
          y = !!sym(x),
          x = tmp_c_cyr,
          color = main_bas
          )) +
      geom_line() +
      theme(legend.position = "none")
  }
)
plot_grid(plotlist = p_tmp, ncol = 3)

re <- paste0("~ dist_up_km + (1 | main_bas)")
pred <- na.omit(slp_env)
for (i in seq_along(var_temporal_trends)) {
  tmp <- predict(trend_env[[i]],
    re.form = as.formula(re)
    )[, 1]
  names(tmp) <- NULL
  pred[[var_temporal_trends[i]]] <- tmp
}
p <- map(
  c("log_total_abundance", "log_species_nb", "jaccard",
      "appearance", "disappearance", "turnover",
      "nestedness", "hillebrand"),
  function(x) {

    pred %>%
      ggplot(aes(
          y = !!sym(x),
          x = dist_up_km,
          color = as.factor(main_bas),
          shape = as.factor(ecoregion)
          )) +
      geom_line() +
      theme(legend.position = "none")
  }
)
plot_grid(plotlist = p, ncol = 3)

re <- paste0("~ tmp_dc_cyr + (1 | main_bas)")
pred_tmp <- from_data_to_predict(
  model_list = trend_env,
  dataset = slp_env,
  re = re
)
p_tmp <- map(
  c("log_species_nb", "jaccard", "appearance", "disappearance", "turnover", "hillebrand"),
  function(x) {
    pred_tmp %>%
      ggplot(aes(
          y = !!sym(x),
          x = tmp_dc_cyr,
          color = as.factor(main_bas)
          )) +
      geom_line() +
      theme(legend.position = "none")
  }
)
plot_grid(plotlist = p_tmp, ncol = 3)

  • Ecoregion:
re <- paste0("~ dist_up_km + (1 + dist_up_km | ecoregion)")
pred_dist_ecoregion <- from_data_to_predict(
  model_list = trend_env,
  dataset = slp_env,
  re = re
)
p_dist_ecoregion <- map(
  c("log_species_nb", "jaccard", "appearance", "disappearance", "turnover", "hillebrand"),
  function(x) {

    pred_dist_ecoregion %>%
      ggplot(aes(
          y = !!sym(x),
          x = dist_up_km,
          color = as.factor(ecoregion)
          )) +
      geom_line() +
      theme(legend.position = "none")
  }
)
plot_grid(plotlist = p_dist_ecoregion, ncol = 3)

re <- paste0("~ tmp_dc_cyr + (1 + tmp_dc_cyr | ecoregion)")
pred_tmp_ecoregion <- from_data_to_predict(
  model_list = trend_env,
  dataset = slp_env,
  re = re
)
p_tmp_ecoregion <- map(
  c("log_species_nb", "jaccard", "appearance", "disappearance", "turnover", "hillebrand"),
  function(x) {
    pred_tmp_ecoregion %>%
      ggplot(aes(
          y = !!sym(x),
          x = tmp_dc_cyr,
          color = as.factor(main_bas)
          )) +
      geom_line() +
      theme(legend.position = "none")
  }
)
plot_grid(plotlist = p_tmp_ecoregion, ncol = 3)

5.8 Analysis

5.9 Reproducibility

Reproducibility receipt

## datetime
Sys.time()
#> [1] "2022-02-03 09:57:32 CST"

## repository
if(requireNamespace('git2r', quietly = TRUE)) {
  git2r::repository()
} else {
  c(
    system2("git", args = c("log", "--name-status", "-1"), stdout = TRUE),
    system2("git", args = c("remote", "-v"), stdout = TRUE)
  )
}
#> Local:    main /home/alain/Documents/post-these/isu/RivFishTimeBiodiversityFacets
#> Head:     [3deb541] 2022-02-02: spamm model basin as factor

## session info
sessionInfo()
#> R version 4.0.5 (2021-03-31)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Debian GNU/Linux 10 (buster)
#> 
#> Matrix products: default
#> BLAS:   /home/alain/.Renv/versions/4.0.5/lib/R/lib/libRblas.so
#> LAPACK: /home/alain/.Renv/versions/4.0.5/lib/R/lib/libRlapack.so
#> 
#> locale:
#>  [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8    
#>  [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8   
#>  [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] parallel  stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#>  [1] spaMM_3.9.25            cachem_1.0.4           
#>  [3] memoise_2.0.0           factoextra_1.0.7       
#>  [5] ade4_1.7-16             inlatools_0.0.1.9001   
#>  [7] INLA_21.11.22           sp_1.4-5               
#>  [9] foreach_1.5.1           Matrix_1.3-2           
#> [11] future_1.21.0           slider_0.2.2           
#> [13] vegan_2.5-7             lattice_0.20-41        
#> [15] permute_0.9-5           codyn_2.0.5            
#> [17] janitor_2.1.0           viridis_0.5.1          
#> [19] viridisLite_0.3.0       cowplot_1.1.1          
#> [21] terra_1.4-22            rnaturalearthdata_0.1.0
#> [23] rnaturalearth_0.1.0     sf_1.0-4               
#> [25] scales_1.1.1            kableExtra_1.3.1       
#> [27] here_1.0.1              lubridate_1.7.9.2      
#> [29] magrittr_2.0.1          forcats_0.5.1          
#> [31] stringr_1.4.0           dplyr_1.0.4            
#> [33] purrr_0.3.4             readr_2.1.1            
#> [35] tidyr_1.1.2             tibble_3.1.6           
#> [37] ggplot2_3.3.3           tidyverse_1.3.0        
#> [39] tarchetypes_0.3.2       targets_0.8.1          
#> [41] conflicted_1.1.0        rmarkdown_2.11         
#> [43] nvimcom_0.9-123        
#> 
#> loaded via a namespace (and not attached):
#>   [1] readxl_1.3.1        backports_1.2.1     igraph_1.2.6       
#>   [4] splines_4.0.5       listenv_0.8.0       digest_0.6.27      
#>   [7] htmltools_0.5.1.1   fansi_0.5.0         cluster_2.1.1      
#>  [10] tzdb_0.2.0          openxlsx_4.2.3      globals_0.14.0     
#>  [13] modelr_0.1.8        prettyunits_1.1.1   colorspace_2.0-0   
#>  [16] rvest_0.3.6         ggrepel_0.9.1       warp_0.2.0         
#>  [19] haven_2.3.1         xfun_0.28           callr_3.7.0        
#>  [22] crayon_1.4.2        jsonlite_1.7.2      iterators_1.0.13   
#>  [25] glue_1.5.1          registry_0.5-1      gtable_0.3.0       
#>  [28] webshot_0.5.2       car_3.0-10          abind_1.4-5        
#>  [31] DBI_1.1.1           rstatix_0.7.0       Rcpp_1.0.6         
#>  [34] progress_1.2.2      units_0.6-7         proxy_0.4-25       
#>  [37] foreign_0.8-81      httr_1.4.2          wk_0.5.0           
#>  [40] ellipsis_0.3.2      pkgconfig_2.0.3     farver_2.0.3       
#>  [43] sass_0.3.1          dbplyr_2.1.0        utf8_1.2.2         
#>  [46] tidyselect_1.1.1    labeling_0.4.2      rlang_0.4.12       
#>  [49] munsell_0.5.0       cellranger_1.1.0    tools_4.0.5        
#>  [52] cli_3.1.0           generics_0.1.0      broom_0.7.4        
#>  [55] evaluate_0.14       fastmap_1.1.0       yaml_2.2.1         
#>  [58] processx_3.5.2      knitr_1.36          fs_1.5.1           
#>  [61] zip_2.1.1           s2_1.0.7            pbapply_1.5-0      
#>  [64] nlme_3.1-152        slam_0.1-49         ROI_1.0-0          
#>  [67] xml2_1.3.2          compiler_4.0.5      rstudioapi_0.13    
#>  [70] curl_4.3.2          e1071_1.7-4         ggsignif_0.6.1     
#>  [73] reprex_1.0.0        bslib_0.2.4         stringi_1.7.6      
#>  [76] highr_0.9           ps_1.6.0            rgeos_0.5-5        
#>  [79] nloptr_1.2.2.2      classInt_0.4-3      vctrs_0.3.8        
#>  [82] pillar_1.6.4        lifecycle_1.0.1     jquerylib_0.1.3    
#>  [85] data.table_1.13.6   R6_2.5.1            bookdown_0.24      
#>  [88] KernSmooth_2.23-18  gridExtra_2.3       rio_0.5.16         
#>  [91] parallelly_1.23.0   codetools_0.2-18    boot_1.3-27        
#>  [94] MASS_7.3-53.1       assertthat_0.2.1    rprojroot_2.0.2    
#>  [97] withr_2.4.3         mgcv_1.8-34         hms_1.1.1          
#> [100] grid_4.0.5          minqa_1.2.4         class_7.3-18       
#> [103] snakecase_0.11.0    carData_3.0-4       git2r_0.29.0       
#> [106] ggpubr_0.4.0        numDeriv_2016.8-1.1

References

Barnagaud, Jean-Yves, Pierre Gaüzère, Benjamin Zuckerberg, Karine Princé, and Jens-Christian Svenning. 2017. “Temporal Changes in Bird Functional Diversity Across the United States.” Oecologia 185 (4): 737–48. https://doi.org/10.1007/s00442-017-3967-4.

Blowes, Shane A., Sarah R. Supp, Laura H. Antão, Amanda Bates, Helge Bruelheide, Jonathan M. Chase, Faye Moyes, et al. 2019. “The Geography of Biodiversity Change in Marine and Terrestrial Assemblages.” Science 366 (6463): 339–45. https://doi.org/10.1126/science.aaw1620.

Dornelas, Maria, Nicholas J. Gotelli, Brian McGill, Hideyasu Shimadzu, Faye Moyes, Caya Sievers, and Anne E. Magurran. 2014. “Assemblage Time Series Reveal Biodiversity Change but Not Systematic Loss.” Science 344 (6181): 296–99. https://doi.org/10.1126/science.1248484.

Hillebrand, Helmut, Bernd Blasius, Elizabeth T. Borer, Jonathan M. Chase, John A. Downing, Britas Klemens Eriksson, Christopher T. Filstrup, et al. 2018. “Biodiversity Change Is Uncoupled from Species Richness Trends: Consequences for Conservation and Monitoring.” Journal of Applied Ecology 55 (1): 169–84. https://doi.org/https://doi.org/10.1111/1365-2664.12959.

Mouchet, Maud A., Sébastien Villéger, Norman W. H. Mason, and David Mouillot. 2010. “Functional Diversity Measures: An Overview of Their Redundancy and Their Ability to Discriminate Community Assembly Rules.” Functional Ecology 24 (4): 867–76. https://doi.org/10.1111/j.1365-2435.2010.01695.x.

Soininen, Janne, Sophia Passy, and Helmut Hillebrand. 2012. “The Relationship Between Species Richness and Evenness: A Meta-Analysis of Studies Across Aquatic Ecosystems.” Oecologia 169 (3): 803–9. https://doi.org/10.1007/s00442-011-2236-1.

Vellend, Mark, Lander Baeten, Isla H. Myers-Smith, Sarah C. Elmendorf, Robin Beauséjour, Carissa D. Brown, Pieter De Frenne, Kris Verheyen, and Sonja Wipf. 2013. “Global Meta-Analysis Reveals No Net Change in Local-Scale Plant Biodiversity over Time.” Proceedings of the National Academy of Sciences 110 (48): 19456–9.